/*https://codeforces.com/contest/689/submission/284071356*/

#include<iostream>
#define ll long long
using namespace std;

ll check(ll n){
    ll ans = 0;
    for(ll i = 2;i*i*i <= n;i++)
        ans += n/i/i/i;
    return ans;
}

int main()
{
    ll m;
    cin >> m;
    ll l = 1,r = 1e18+10;
    ll res = -1;
    while(l <= r){
        ll mid = l + (r-l)/2;
        if(check(mid) >= m){
            r = mid-1;
            res = mid;
        }else{
            l = mid+1;   
        }
    }
    if(res == -1)cout << -1;
    else if(check(res) == m)cout << res;
    else cout << -1;
    
    return 0;
}